#ifndef _NET_SELECT_H
#define _NET_SELECT_H

#include "defines.h"

class CNetSelect 
{  
public:  
	enum   
	{  
	  SUCCESS		= 0x0000, 
	  RETRY			= 0x1000, 
	  DISCONNECT	= 0x1001, 
	  SOCKETERROR	= 0x1002,
	};  

	CNetSelect();  
	~CNetSelect();  

	xgc_void		SendErrorCodeEx( xgc_int32 nErrorCode );  
	xgc_bool		InitSocket();
	xgc_int32		Connect( xgc_lpcstr address, xgc_uint16 port );
	xgc_bool		Disconnect(); 

	xgc_int32		Send( xgc_lpcstr pszBuffer, xgc_size size );  
	xgc_int32		Recv( xgc_lpstr pszBuffer, xgc_size size );  

	xgc_int32		GetLastError(){ return m_nErrorCode; }

protected:  
	int	m_nErrorCode;
	int	m_socket;  
};  
#endif
